<?php

/**
 * Created by PhpStorm.
 * User: Duyonggao
 * Date: 2017/8/16 0016
 * Time: 上午 11:42
 */
use PHPUnit\Framework\TestCase;

/**
 * Class EmailTest
 * 测试命令
 * php D:\test\mytest\phpunit-5.6.8.phar --bootstrap D:\test\mytest\class\Email.php D:\test\mytest\test\EmailTest.php
 *
 * 需要php环境变量
 */
class EmailTest extends TestCase
{
    public function testCanBeCreatedFromValidEmailAddress()
    {
        $this->assertInstanceOf(
            Email::class,
            Email::fromString('user@example.com')
        );
    }

    public function testCannotBeCreatedFromInvalidEmailAddress()
    {
        $this->expectException(InvalidArgumentException::class);

        Email::fromString('invalid');
    }

    public function testCanBeUsedAsString()
    {
        $this->assertEquals(
            'user@example.com',
            Email::fromString('user@example.com')
        );
    }
}